package org.person.gift.service.impl;

import org.person.gift.doc.GiftSpuDoc;
import org.person.gift.repository.GiftDocRepository;
import org.person.gift.service.IGiftSpuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GiftSpuServiceImpl implements IGiftSpuService {
    @Autowired
    private GiftDocRepository repository;
    @Override
    public void onsale(List<GiftSpuDoc> giftDocs) {
        repository.saveAll(giftDocs);
    }

    @Override
    public void offsale(List<Long> ids) {
        //根据传递过来的id删除es中下架了的数据
        ids.forEach(id -> repository.deleteById(id));
    }
}
